luci-base: widgets shall show devices that are online as online
authorPaul Donald <[email protected]>
Wed, 23 Apr 2025 12:03:28 +0000 (14:03 +0200)
committerPaul Donald <[email protected]>
Wed, 23 Apr 2025 12:03:28 +0000 (14:03 +0200)
Tunnel devices which are up, show as down, since they don't have access
to any device status. The 'device' being enumerated is e.g.
'wireguard_wg0', a configuration for a tunnel interface, whose parent
is an 'ethernet' type.

That's a bug for another day. So they shall get parent device status.

Signed-off-by: Paul Donald <[email protected]>
modules/luci-base/htdocs/luci-static/resources/tools/widgets.js

index 0d8dba323ab890542764b4ccc803ffe7456f783e..4573dca15bbef98f903ada87fb0c8f1bfd218693 100644 (file)
@@ -111,7 +111,7 @@ var CBIZoneSelect = form.ListValue.extend({
                                        continue;
 
                                var span = E('span', {
-                                       'class': 'ifacebadge' + (network.getName() == this.network ? ' ifacebadge-active' : '')
+                                       'class': 'ifacebadge' + (network.isUp() ? ' ifacebadge-active' : '')
                                }, network.getName() + ': ');
 
                                var devices = getDevices(network);
@@ -119,7 +119,7 @@ var CBIZoneSelect = form.ListValue.extend({
                                for (var k = 0; k < devices.length; k++) {
                                        span.appendChild(E('img', {
                                                'title': devices[k].getI18n(),
-                                               'src': L.resource('icons/%s%s.png'.format(devices[k].getType(), devices[k].isUp() ? '' : '_disabled'))
+                                               'src': L.resource('icons/%s%s.png'.format(devices[k].getType(), network.isUp() ? '' : '_disabled'))
                                        }));
                                }
 
@@ -255,7 +255,7 @@ var CBIZoneForwards = form.DummyValue.extend({
                                continue;
 
                        var span = E('span', {
-                               'class': 'ifacebadge' + (network.getName() == this.network ? ' ifacebadge-active' : '')
+                               'class': 'ifacebadge' + (network.isUp() ? ' ifacebadge-active' : '')
                        }, network.getName() + ': ');
 
                        var subdevs = getDevices(network);
@@ -263,7 +263,7 @@ var CBIZoneForwards = form.DummyValue.extend({
                        for (var k = 0; k < subdevs.length && subdevs[k]; k++) {
                                span.appendChild(E('img', {
                                        'title': subdevs[k].getI18n(),
-                                       'src': L.resource('icons/%s%s.png'.format(subdevs[k].getType(), subdevs[k].isUp() ? '' : '_disabled'))
+                                       'src': L.resource('icons/%s%s.png'.format(subdevs[k].getType(), network.isUp() ? '' : '_disabled'))
                                }));
                        }
 
@@ -537,7 +537,7 @@ var CBIDeviceSelect = form.ListValue.extend({
                                var item = E([
                                        E('img', {
                                                'title': device.getI18n(),
-                                               'src': L.resource('icons/alias%s.png'.format(net.isUp() ? '' : '_disabled'))
+                                               'src': L.resource('icons/alias%s.png'.format(device.isUp() ? '' : '_disabled'))
                                        }),
                                        E('span', { 'class': 'hide-open' }, [ name ]),
                                        E('span', { 'class': 'hide-close'}, [ device.getI18n() ])